package cn.edu.zzuli.admin.listener;


import cn.edu.zzuli.admin.mapper.IdentityMapper;
import cn.edu.zzuli.model.entity.Identity;
import cn.edu.zzuli.model.vo.identity.IdentityVo;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.springframework.beans.BeanUtils;

public class IdentityVoListener extends AnalysisEventListener<IdentityVo> {


    private IdentityMapper identityMapper;

    public IdentityVoListener() {
    }

    public IdentityVoListener(IdentityMapper identityMapper) {
        this.identityMapper = identityMapper;
    }

    @Override
    public void invoke(IdentityVo identityVo, AnalysisContext analysisContext) {
        Identity identity = new Identity();
        BeanUtils.copyProperties(identityVo,identity);
        identityMapper.insert(identity);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
